00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031 #ifdef _DEBUG
00032 #define DBGOUT(text)\
00033 TheApi.DebugOut(text);
00034 #else
00035 #define DBGOUT(text)
00036 #endif
00037
00038
00039
00040
00041
00042
00043
00044
00045
00046
00047
00048
00049
00050
00051
00052 class deApi
00053 {
00054 friend class deApiHandle;
00055
00056 public:
00057
00058
00059
00060 bool InitApi(HWND hWindow);
00061
00062
00063 unsigned long GetNextRuntimeID();
00064
00065
00066 deApiHandle GetNodeTree();
00067
00068
00069
00070 deApiHandle CreateObject(deApiObject* pObject);
00071 bool DestroyObject(unsigned long runtimeID);
00072
00073
00074 HWND GetWindowHandle() { return m_hWindow; }
00075
00076
00077 deApiObject* GetObjectFromHandle(deApiHandle handle);
00078
00079
00080
00081 void DebugOut(const deString& sText);
00082
00083
00084
00085
00086
00087
00088
00089
00090 unsigned long runtimeID;
00091 deApiNodeTree* m_pNodeTree;
00092 deApiRender* m_pRender;
00093 HWND m_hWindow;
00094 unsigned long m_iOutputWindow;
00095 };
00096
00097
00098
00099 #define TheApi deApi_GetManager()
00100
00101
00102
00103
00104
00105
00106
00107
00108
00109
00110
00111 class deApiObject
00112 {
00113 public:
00114 deApiObject();
00115 virtual ~deApiObject();
00116
00117 DECLARE_RTI;
00118
00119
00120
00121
00122 virtual bool IsNull();
00123
00124 virtual unsigned long GetRuntimeID();
00125 virtual unsigned long GetGlobalIDPrefix();
00126 virtual unsigned char GetGlobalID();
00127
00128 virtual void DumpObject();
00129 virtual int GetReferenceCount();
00130 virtual void RemoveReference();
00131 virtual void AddReference();
00132
00133 protected:
00134 bool bNull;
00135 int iReferenceCount;
00136 };
00137 DECLARE_RTI_BASE(deApiObject);
00138
00139
00140
00141
00142
00143
00144 class deApiNodeTree : public deApiObject
00145 {
00146
00147
00148
00149 friend class deApi;
00150
00151
00152
00153
00154 friend class deApiHandle;
00155 friend class deApiFn;
00156
00157 public:
00158
00159
00160 deApiHandle GetNode(unsigned long runtimeID);
00161
00162
00163 void GetNodes(deTArray<unsigned long>& aReturn, deString& TypeFilter = deString(""), int iMaxCount = -1);
00164
00165
00166 deApiNodeTree();
00167
00168
00169 ~deApiNodeTree();
00170
00171 DECLARE_RTI;
00172
00173
00174
00175 private:
00176
00177
00178
00179
00180
00181 unsigned long AddNode(deApiObject* pNewObject);
00182
00183
00184 bool DestroyNode(unsigned long runtimeID);
00185
00186
00187
00188
00189 deApiObject* GetApiObject(unsigned long runtimeID);
00190
00191 private:
00192 deTArray<deApiObject*> m_tarrayNodes;
00193 deTArray<unsigned long> m_runtimeIDs;
00194
00195 };
00196 DEFINE_RTI(deApiNodeTree,deApiObject);
00197
00198
00199
00200
00201
00202 class deApiNode : public deApiObject
00203 {
00204 public:
00205 deApiNode() {};
00206 ~deApiNode() {};
00207 DECLARE_RTI;
00208 };
00209 DEFINE_RTI(deApiNode,deApiObject);
00210
00211
00212
00213
00214
00215 class deApiStaticBrush : public deApiNode
00216 {
00217 DECLARE_RTI;
00218 };
00219 DEFINE_RTI(deApiStaticBrush,deApiNode);
00220
00221
00222
00223
00224
00225
00226
00227 class deApiAttribute: public deApiObject
00228 {
00229 public:
00230 enum Type
00231 {
00232 Invalid = 0,
00233 Float,
00234 Int,
00235 Vector,
00236 Bool,
00237 Color_RGB,
00238 Color_Alpha,
00239 Color_RGBA,
00240 UV,
00241 UVW,
00242 Transform,
00243 OutOfRange = 65535
00244 };
00245 deApiAttribute();
00246 ~deApiAttribute();
00247 Type GetAttributeType();
00248 unsigned long GetRuntimeID();
00249
00250
00251
00252
00253
00254 protected:
00255 unsigned long runtimeID;
00256 };
00257
00258
00259
00260
00261
00262 class deApiAttribute_Float : public deApiAttribute
00263 {
00264 public:
00265 deApiAttribute_Float();
00266 ~deApiAttribute_Float();
00267 Type GetAttributeType();
00268 void DumpObject();
00269
00270 private:
00271 float data;
00272 };
00273
00274
00275
00276
00277
00278
00279 class deApiAttributeCollection : public deApiObject
00280 {
00281 public:
00282 deApiAttributeCollection();
00283 ~deApiAttributeCollection();
00284
00285 DECLARE_RTI;
00286
00287
00288
00289
00290 bool IsNull();
00291
00292 unsigned short GetAttributeCount();
00293 deApiObject* GetAttribute(unsigned long runtimeID);
00294 void DumpObject();
00295
00296 bool AddAttribute(deApiObject* pAttribute);
00297 private:
00298
00299 deTArray<unsigned long> m_tarrayAttributes;
00300 };
00301 DEFINE_RTI(deApiAttributeCollection,deApiObject);
00302
00303
00304
00305
00306 class deApiOutputWindow : public deApiObject
00307 {
00308 public:
00309
00310
00311 deApiOutputWindow();
00312
00313
00314 ~deApiOutputWindow();
00315
00316
00317 deApiTypes::StatusCode CreateOutputWindow(int x, int y, int width, int height, const char* title, bool bSizeable = true, bool bCaption = true);
00318
00319
00320 void DestroyOutputWindow() { if(m_hWindow) DestroyWindow(m_hWindow); }
00321
00322
00323 HWND GetWindowHandle() { return m_hWindow; }
00324
00325
00326 void AddLogText(const deString& text);
00327
00328
00329 void Hide(bool bHide);
00330
00331
00332 deString GetLogText();
00333
00334
00335 DECLARE_RTI;
00336
00337
00338 private:
00339 HWND m_hWindow;
00340 deString m_sText;
00341 };
00342 DEFINE_RTI(deApiOutputWindow,deApiObject);
00343
00344
00345
00346
00347
00348
00349
00350 class deApiRender : public deApiObject
00351 {
00352 DECLARE_RTI;
00353 public:
00354 bool Init(deString& sDriverName);
00355 void BeginFrame();
00356 void EndFrame();
00357 void Render();
00358 void SetState();
00359 private:
00360 IdeRender* m_pRender;
00361 IdeDriver* m_pDriver;
00362 };
00363 DEFINE_RTI(deApiRender, deApiObject);
00364
00365
00366
00367
00368 class deApiCamera : public deApiObject
00369 {
00370 DECLARE_RTI;
00371 public:
00372 deApiCamera();
00373 virtual ~deApiCamera();
00374
00375 void SetFOV(deDouble dDegrees);
00376 void SetOrthoWidth(deDouble dWidth);
00377 void EnableOrtho(bool bEnable);
00378 deTransform GetTransform();
00379 void SetTransform(deTransform transform);
00380 void SetName(const deString& sName);
00381 deString& GetName();
00382 deDouble GetFOV();
00383 deDouble GetOrthoWidth();
00384 bool IsOrtho();
00385 deDouble GetNearClip();
00386 deDouble GetFarClip();
00387 void SetClip(deDouble dNear, deDouble dFar);
00388 IdeCamera* GetDestinyCamera();
00389 private:
00390 IdeCamera* m_pCamera;
00391 deString m_sName;
00392 deDouble m_dFOV;
00393 deDouble m_dOrthoWidth;
00394 bool m_bIsOrtho;
00395 deDouble m_dNearClip;
00396 deDouble m_dFarClip;
00397 deTransform m_Transform;
00398 };
00399 DEFINE_RTI(deApiCamera, deApiObject);